import 'package:flutter/material.dart';
import 'package:flutter_swiper/flutter_swiper.dart';

class SwiperPage extends StatefulWidget {
  @override
  _SwiperPageState createState() => new _SwiperPageState();
}

class _SwiperPageState extends State<SwiperPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Swiper"),
      ),
      body: _buildListView(),
    );
  }

  Widget _buildListView() {
    return ListView.builder(
      itemBuilder: (context, index) {
        return _buildListViewItem(index);
      },
      itemCount: swipers.length,
    );
  }

  Widget _buildListViewItem(index) {
    return Container(
      padding: EdgeInsets.all(10.0),
      alignment: Alignment.center,
      child: swipers[index],
    );
  }
}

List<Widget> swipers = <Widget>[
  Column(
    children: <Widget>[
      Text("Swiper"),
      Container(
        height: 150,
        child: Swiper(
          itemBuilder: (BuildContext context, int index) {
            return Image.asset(
              "assets/images/cat.jpeg",
              fit: BoxFit.fill,
            );
          },
          itemCount: 5,
          viewportFraction: 0.8,
          scale: 0.9,
        ),
      ),
    ],
  ),
];
